<?php

namespace plugin\coupon\app\model;

use support\spark\BaseModel;

class Coupon extends BaseModel
{
    const CREATED_AT = 'create_time';
    const UPDATED_AT = 'update_time';
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'coupon';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';


    public function goods()
    {
        return $this->hasMany(CouponGoods::class, 'coupon_id', 'id');
    }

    public function couponGoods()
    {
        return $this->hasMany(CouponGoods::class, 'coupon_id', 'id')->visible(['id']);
    }
}